package model

import (
	"community_end/utils/errmsg"
	"gorm.io/gorm"
)

type BillBoard struct {
	gorm.Model
	Content string `json:"content"`
	Show    int    `json:"show"`
}

func (BillBoard) TableName() string {
	return "bill_board"
}

func SelectAllBillBoard() (BillBoard, int) {
	var billBoards BillBoard
	err := db.First(&billBoards).Error
	if err != nil && gorm.ErrRecordNotFound != nil {
		return BillBoard{}, errmsg.BILLBOARD_SELECT_ALL_FAILED
	}
	return billBoards, errmsg.SUCCESS
}
